#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;

int minRefills(int n, int k, vector<int>& stops) {
    int count = 0, tmp = 0;
    for (int i = 0; i <= k; i++) 
    {
        if (stops[i] > n) return -1;
        tmp += stops[i];
        if (tmp > n)
        {
            count++;
            i--;
            tmp = 0;
        }
    }
    
    return count;
}

int main() {
    ifstream inputFile("input.txt");
    ofstream outputFile("output.txt");

    int n, k;
    inputFile >> n >> k;
    vector<int> stops(k + 1);
    for (int i = 0; i <= k; i++)
    {
        inputFile >> stops[i];
        // cout << stops[i] << " ";
    }

    int res = minRefills(n, k, stops);
    if (res == -1) outputFile << "No Solution";
    else outputFile << res;
    cout << res << endl;

    inputFile.close();
    outputFile.close();

    return 0;
}